package com.authorization.project.single.service.impl;

import java.util.List;
import com.authorization.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.authorization.project.single.mapper.SingleAuthorizationMapper;
import com.authorization.project.single.domain.SingleAuthorization;
import com.authorization.project.single.service.ISingleAuthorizationService;

/**
 * 授权注册信息Service业务层处理
 * 
 * @author 李晓雷
 * @date 2020-07-11
 */
@Service
public class SingleAuthorizationServiceImpl implements ISingleAuthorizationService 
{
    @Autowired
    private SingleAuthorizationMapper singleAuthorizationMapper;

    /**
     * 查询授权注册信息
     * 
     * @param userid 授权注册信息ID
     * @return 授权注册信息
     */
    @Override
    public SingleAuthorization selectSingleAuthorizationById(String userid)
    {
        return singleAuthorizationMapper.selectSingleAuthorizationById(userid);
    }

    /**
     * 查询授权注册信息列表
     * 
     * @param singleAuthorization 授权注册信息
     * @return 授权注册信息
     */
    @Override
    public List<SingleAuthorization> selectSingleAuthorizationList(SingleAuthorization singleAuthorization)
    {
        return singleAuthorizationMapper.selectSingleAuthorizationList(singleAuthorization);
    }

    /**
     * 新增授权注册信息
     * 
     * @param singleAuthorization 授权注册信息
     * @return 结果
     */
    @Override
    public int insertSingleAuthorization(SingleAuthorization singleAuthorization)
    {
        singleAuthorization.setUserid(singleAuthorization.getUserNumber());
        singleAuthorization.setCreateTime(DateUtils.getNowDate());
        return singleAuthorizationMapper.insertSingleAuthorization(singleAuthorization);
    }

    /**
     * 修改授权注册信息
     * 
     * @param singleAuthorization 授权注册信息
     * @return 结果
     */
    @Override
    public int updateSingleAuthorization(SingleAuthorization singleAuthorization)
    {
        singleAuthorization.setUserid(singleAuthorization.getUserNumber());
        singleAuthorization.setUpdateTime(DateUtils.getNowDate());
        return singleAuthorizationMapper.updateSingleAuthorization(singleAuthorization);
    }

    /**
     * 批量删除授权注册信息
     * 
     * @param userids 需要删除的授权注册信息ID
     * @return 结果
     */
    @Override
    public int deleteSingleAuthorizationByIds(String[] userids)
    {
        return singleAuthorizationMapper.deleteSingleAuthorizationByIds(userids);
    }

    /**
     * 删除授权注册信息信息
     * 
     * @param userid 授权注册信息ID
     * @return 结果
     */
    @Override
    public int deleteSingleAuthorizationById(String userid)
    {
        return singleAuthorizationMapper.deleteSingleAuthorizationById(userid);
    }
}
